<?php

class items_top extends Model
{
	public function __construct()
	{
		//初始化
		$this->init_top();
	}

	//商品折扣信息  //暂未用了
	public function UmpPromotionGetRequest($item_id)
	{
		$req = new UmpPromotionGetRequest;
		$req->setItemId($item_id);
		$resp = $this->c->execute($req, $this->top_session);
		//$appLog->info($resp);
		return $resp;
	}

	//仓库中的商品
	public function ItemsInventoryGetRequest($q="",$pageno=1,$pagesize=10,$seller_cids=0,$filds = "num_iid,title,price,pic_url,cid")
	{
		$req = new ItemsInventoryGetRequest;
		$req->setFields($filds);
		if($q)$req->setQ($q);
		if($seller_cids)$req->setSellerCids($seller_cids);
		$req->setPageNo($pageno);
		$req->setPageSize($pagesize);
		$resp = $this->c->execute($req, $this->top_session);
		return $resp;
	}

	//出售中的商品
	public function ItemsOnsaleGetRequest($q="",$pageno=1,$pagesize=10,$seller_cids=0,$filds = "num_iid,title,price,pic_url,cid,sold_quantity")
	{
		$req = new ItemsOnsaleGetRequest;
		$req->setFields($filds);
		if($q)$req->setQ($q);
		if($seller_cids)$req->setSellerCids($seller_cids);
		$req->setPageNo($pageno);
		$req->setPageSize($pagesize);
		$resp = $this->c->execute($req, $this->top_session);
		return $resp;
	}

    //批量取商品详情
    public function ItemsSellerListGetRequest($num_iids='',$filds = "num_iid,seller_cids,title,price,period_sold_quantity,approve_status,item_img.url,sku.price,sku.properties_name,sku.sku_id,sku.sku_feature")
    {
        $req = new ItemsSellerListGetRequest;
        $req->setFields($filds);
        $req->setNumIids($num_iids);
        $resp = $this->c->execute($req, $this->top_session);
        return $resp;
    }

	//卖家商品分类
	public function SellercatsListGetRequest($nick)
	{
		$req = new SellercatsListGetRequest;
		$req->setNick($nick);
		$resp = $this->c->execute($req);
		return $resp;
	}

	//new add
	#taobao.item.update (更新商品信息) ;可用来设置自动上架，更新商品的上架时间实现自动上架。
	public function setListTime($num_iid,$time){
		$req = new ItemUpdateRequest;
		$req->setNumIid($num_iid);
		$req->setListTime($time);//上架时间。大于当前时间则宝贝会下架进入定时上架的宝贝中。
		$resp = $this->c->execute($req, $this->top_session);
		return $resp;
	}
}